const query = (function() {
    const query = {};
    /** 不需要分两步取值 */
    const search = /.*\?([^\?]+)/.exec(location.href)[1];
    /** 使用三元直接赋值 */
    const searchArr = search.indexOf("&") ? search.split("&") : search.split();
    searchArr.forEach((item) => {
        const queryArr = item.split("=");
        query[queryArr[0]] = queryArr[1];
    });
    return query;
})();
// console.log(query);
let uu = document.querySelector('ul');
fetch("http://chst.vip:1234/api/getinlanddiscount")
.then(body=>body.json()
.then(res =>{
    let html = "";
    console.log(res);
    // console.log(res.result[query.productid]);
    let item=res.result[query.productid]
    // console.log(query.productid);
    // console.log(item);
        html = `
  <ul class="info">
  <li>
  <div class="infoR">
  <div class="title">
  <h4>${item.productName}</h4>
  </div>
  <div class="other">
  <span class="mall fl">${item.productFrom} | ${item.productTime}</span>
  <i>${item.productTips}</i>
  <div>${item.productPrice}</div>
  </div>
  <div class="container">
  <div class="info2">${item.productInfo}</div>
  <p>${item.productImg}</p>
  </div>
  <div class="city"></div>
  </div>
  </li>
  </ul>
  `
    uu.innerHTML = html;
}))
